package qst.com.bacK.pojo.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Author:   msh
 * Date:     2024/10/8 下午8:46
 * Description:
 */

@Data
public class BaseEntity implements Serializable {
    protected Integer id;
    // 传递数据用
    private Map<Object, Object> extras = new HashMap<>();
    // 转换代号到描述信息
    private static Map<String, String> desc = new HashMap<>();

    protected static String getDesc(Class clazz, String prefix, int code) {
        return desc.get(clazz.getName() + "-" + prefix + code);
    }

    protected static void addDesc(Class clazz, String... descs) {
        for (int i = 1; i < descs.length; i += 2) {
            desc.put(clazz.getName() + "-" + descs[i - 1], descs[i]);
        }
    }
}
